package com.lagou.order.listener;

import com.lagou.order.service.GoodService;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.annotation.SelectorType;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author stevejson
 */
@Component
@RocketMQMessageListener(topic = "topic-order", consumerGroup = "consumer-group-1", selectorExpression = "delay || create",
        selectorType = SelectorType.TAG, messageModel = MessageModel.CLUSTERING)
public class OrderListener implements RocketMQListener<String> {

    @Resource
    private GoodService goodService;

    @Override
    public void onMessage(String s) {
        goodService.cancelGood(Integer.parseInt(s));

    }
}
